﻿using System;
using System.Collections.Generic;
using GurLoader.Service.ImgurTaskBuilder;
using Imgur.Net;
using NUnit.Framework;

namespace GurLoaderWPF.Test.Service.ImgurTaskBuilder
{
    [TestFixture]
    public class BatchUploadImageResultTests
    {
        [Test]
        public void CreateInstanceTest()
        {
            List<ImageUploadResult> results = new List<ImageUploadResult>();
            results.Add(new ImageUploadResult(new ImageInfo("aaaa", string.Empty, string.Empty, DateTime.Now, 20, 20)));
            results.Add(new ImageUploadResult(new ImageInfo("bbbb", string.Empty, string.Empty, DateTime.Now, 20, 20)));
            results.Add(new ImageUploadResult(new ImageInfo("cccc", string.Empty, string.Empty, DateTime.Now, 20, 20)));

            BatchImageUploadResult obj = new BatchImageUploadResult(results);

            Assert.IsNotNull(obj);
        }

        [Test]
        [ExpectedException(typeof(ArgumentException), ExpectedMessage = "One or more result objects required.")]
        public void CreateInstanceNullTest()
        {
            BatchImageUploadResult obj = new BatchImageUploadResult(null);
        }

        [Test]
        public void GetResultsTest()
        {
            List<ImageUploadResult> results = new List<ImageUploadResult>();
            results.Add(new ImageUploadResult(new ImageInfo("aaaa", string.Empty, string.Empty, DateTime.Now, 20, 20)));
            results.Add(new ImageUploadResult(new ImageInfo("bbbb", string.Empty, string.Empty, DateTime.Now, 20, 20)));
            results.Add(new ImageUploadResult(new ImageInfo("cccc", string.Empty, string.Empty, DateTime.Now, 20, 20)));

            BatchImageUploadResult obj = new BatchImageUploadResult(results);

            Assert.IsNotNull(obj);

            CollectionAssert.AreEqual(results, obj.Results);
        }
    }
}
